﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:v="clr-namespace:ShredTheLog.Views;assembly=ShredTheLog.Views"
    xmlns:vm="clr-namespace:ShredTheLog.ViewModels;assembly=ShredTheLog.ViewModels"
    xmlns:cnv="clr-namespace:ShredTheLog.Converters;assembly=ShredTheLog.Converters"
    xmlns:c="clr-namespace:ShredTheLog.Controls;assembly=ShredTheLog.Controls"
    >

    <DataTemplate DataType="{x:Type vm:MainViewModel}">
        <DockPanel>
            <Menu DockPanel.Dock="Top" VerticalAlignment="Top">
                <MenuItem Header="{c:LocalizedString s_Menu}">
                    <MenuItem Header="{c:LocalizedString s_Login}" c:Extensions.Items="{Binding Path=FileMenuCommands, Converter={x:Static vm:MenuItemsConverter.Default}}"/>
                    <MenuItem Header="{c:LocalizedString s_View}" c:Extensions.Items="{Binding Path=ViewMenuCommands, Converter={x:Static vm:MenuItemsConverter.Default}}"/>
                    <MenuItem Header="{c:LocalizedString s_Tools}" c:Extensions.Items="{Binding Path=ToolsMenuCommands, Converter={x:Static vm:MenuItemsConverter.Default}}"/>
                    <MenuItem Header="{c:LocalizedString s_Help}" c:Extensions.Items="{Binding Path=HelpMenuCommands, Converter={x:Static vm:MenuItemsConverter.Default}}"/>
                </MenuItem>
                <MenuItem x:Name="chatRoomsMenuItem" Header="{c:LocalizedString s_ChatRooms}" c:Extensions.Items="{Binding Path=JoinPublicChatRoomCommands, Converter={x:Static vm:MenuItemsConverter.Default}}"/>
            </Menu>

            <TabControl ItemsSource="{Binding Pages}" IsSynchronizedWithCurrentItem="True">
                <TabControl.ItemContainerStyle>
                    <Style TargetType="{x:Type TabItem}" BasedOn="{StaticResource {x:Type TabItem}}">
                        <Style.Resources>
                            <ResourceDictionary Source="SimpleMainTabControlItems.xaml"/>
                        </Style.Resources>
                    </Style>
                </TabControl.ItemContainerStyle>
            </TabControl>
        </DockPanel>
        
        <DataTemplate.Triggers>
            <DataTrigger Binding="{Binding TextChat}" Value="{x:Null}">
                <Setter TargetName="chatRoomsMenuItem" Property="Visibility" Value="Collapsed"/>
            </DataTrigger>
        </DataTemplate.Triggers>
    </DataTemplate>
</ResourceDictionary>